package 华为OD机试B卷复用题.基础题;

import utils.MyUtil;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class HJ71_矩形相交的面积 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new File("src/main/java/华为OD机试B卷复用题/基础题/input/71.txt"));
        MyUtil.START();
        Solution(in);
        MyUtil.END();
    }

    static void Solution(Scanner in) {
        int[] kuan_left = new int[3];
        int[] kuan_right = new int[3];
        int[] gao_top = new int[3];
        int[] gao_bottom = new int[3];
        for(int i=0;i<3;i++){
            String[] sArray = in.nextLine().split(" ");
            int x = Integer.parseInt(sArray[0]);
            int y = Integer.parseInt(sArray[1]);
            int width = Integer.parseInt(sArray[2]);
            int height = Integer.parseInt(sArray[3]);
            kuan_left[i] = x;
            gao_top[i] = y;
            kuan_right[i] = x+width;
            gao_bottom[i] = y-height;
        }
        int kuan_left_max= Arrays.stream(kuan_left).max().getAsInt();
        int kuan_right_min=Arrays.stream(kuan_right).min().getAsInt();;
        int gao_top_min = Arrays.stream(gao_top).min().getAsInt();
        int gao_bottom_max = Arrays.stream(gao_bottom).max().getAsInt();
        int kuan = Math.max(0,kuan_right_min-kuan_left_max);
        int gao = Math.max(0,gao_top_min-gao_bottom_max);
        System.out.println(kuan*gao);
    }
}
